//
//  InformationViewController.m
//  HRJiWei
//
//  Created by bjhj on 16/12/12.
//  Copyright © 2016年 bjhj. All rights reserved.
//

#import "InformationViewController.h"
#import "HJReportCell.h"


@interface InformationViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic,strong)NSMutableArray * cells;

@end

@implementation InformationViewController


-(NSMutableArray *)cells{

    if (_cells==nil) {
        _cells = [NSMutableArray array];
    }
    return _cells;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    

    
    
    
}

-(void)report1{
    
    
    for (int i = 0; i<17; i++) {
        NSIndexPath * idx = [[NSIndexPath alloc]initWithIndex:i];
        HJReportCell * cell = [self.tableView cellForRowAtIndexPath:idx];

        NSLog(@"%@",cell.textContent.placeholder);
    }
    
    
//    for (HJReportCell * cell in self.cells) {
//    
//        NSLog(@"%@",cell.textContent.placeholder);
////        NSLog(@"%ld",[self.cells indexOfObject:cell]);
//    }
    
    
}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    if (self.visible) {//实名举报
        return 2;
    }else{
        return 1;
    }
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    if (section==0) {
        return 8;
    }else{
    
        return 11;
    }
}

-(UITableViewCell * )tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    HJReportCell * cell = [HJReportCell  cellWithTableView:tableView];
    

    
    [self.cells addObject:cell];
    
    
    UIView * view;
    UIImage * image;
    UIImageView * img;
    if (indexPath.section==0) {
        
        switch (indexPath.row) {
            case 0:
                cell.content= @"被举报人姓名";
                
//                cell.textLabel.text = @"sss";
                break;
            case 1:
                cell.textContent.placeholder = @"被举报人性别";

                
                
                image = [UIImage imageNamed:@"more"];
                img = [[UIImageView alloc]initWithImage:image];
                img.frame = CGRectMake(100, 20, 30, 30);
                [cell.contentView addSubview:img];
                break;
                
                
            case 2:
                cell.textContent.placeholder = @"被举报人单位";
                break;
            case 3:
                cell.textContent.placeholder = @"职务";
                break;
            case 4:
                cell.textContent.placeholder = @"政治面貌";
                break;
            case 5:
                cell.textContent.placeholder = @"所属地";
                break;
            case 6:
                cell.textContent.placeholder = @"单位地址或住址";
                break;
            case 7:
                cell.textContent.placeholder = @"级别";
                break;

            default:
                break;
        }
  
    }else{
    
        
        switch (indexPath.row) {
            case 0:
                cell.textContent.placeholder = @"姓名";
                break;
            case 1:
                cell.textContent.placeholder = @"性别";
                break;
            case 2:
                cell.textContent.placeholder = @"民族";
                break;
            case 3:
                cell.textContent.placeholder = @"政治面貌";
                break;
            case 4:
                cell.textContent.placeholder = @"手机号码";
                break;
            case 5:
                cell.textContent.placeholder = @"身份证号";
                break;
            case 6:
                cell.textContent.placeholder = @"所属地";
                break;
            case 7:
                cell.textContent.placeholder = @"邮政编码";
                break;
            case 8:
                cell.textContent.placeholder = @"住址";
                break;
            case 9:
                cell.textContent.placeholder = @"工作单位";
                break;
            case 10:
                cell.textContent.placeholder = @"职务";
                break;

            default:
                break;
        }
        
    
    
    }
    
    return cell;
    
}



-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}






-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    if (section==0) {
        return @"被举报人信息";
    }else{
        return @"举报人信息";
    }
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView * view = [[UIView alloc]init];
    view.backgroundColor = [UIColor redColor];
    
    
    UIButton * btnNext = [[UIButton alloc]initWithFrame:CGRectMake(20, 20, 100, 40)];
    
    [btnNext setTitle:@"下一步" forState:(UIControlStateNormal)];
    
    [btnNext addTarget:self action:@selector(report1) forControlEvents:(UIControlEventTouchUpInside)];
    [view addSubview:btnNext];
    
    return view;
    
}


-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{

    if (section==1) {
        return 100;
    }
    return 0.01;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)BACK:(id)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}




@end
